<?php
namespace app\finance\admin;
use app\system\admin\Admin;
use app\product\model\Supplier as SupplierModel;
use app\finance\model\Account as AccountModel;
use app\finance\model\SystemBalanceLog as SystemBalanceLogModel;
use think\Db;

class SystemBalance extends Admin
{

	public function index()
	{
		if($this->request->isAjax()){
			$where      = $data = [];
            $page       = $this->request->param('page/d', 1);
            $limit      = $this->request->param('limit/d', 15);
            $where['is_effective'] = 1;
            $data['data'] = SystemBalanceLogModel::where($where)
            ->field('*,type as type_text,account_id as account_name')
            ->page($page)->limit($limit)->order('id desc')->select();
            $data['count'] = SystemBalanceLogModel::where($where)->count();
            $data['code']   = 0;
            return json($data);
		}
		return $this->fetch();
	}
} 